from typing import Optional
from pydantic import BaseModel

class AdminBase(BaseModel):
    weid: str
    username: str
    pcate_id: int
    cate_id: int
    relation_id: str
    is_delete: int = 1

class AdminCreate(AdminBase):
    password: str

class AdminUpdate(BaseModel):
    weid: Optional[str] = None
    username: Optional[str] = None
    password: Optional[str] = None
    pcate_id: Optional[int] = None
    cate_id: Optional[int] = None
    relation_id: Optional[str] = None
    is_delete: Optional[int] = None

class Admin(AdminBase):
    id: int
    createtime: int
    logintime: int

    class Config:
        from_attributes = True

